home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 15 / macformat_15.iso / C de cerca / Codewarrior Lite / MacOS Support / Headers / ANSI Headers / ostream < prev    next >
Text File  |  1995-12-29  |  3KB  |  102 lines

  1. // ostream standard header
  2. #ifndef _OSTREAM_
  3. #define _OSTREAM_
  4. #include <streambuf>
  5.  
  6. #if __MWERKS__
  7. #pragma options align=mac68k
  8.  
  9. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  10. #pragma import on
  11. #endif
  12. #endif
  13.  
  14.         // class ostream
  15. class ostream : virtual public ios {
  16. public:
  17.     ostream(streambuf *_S)
  18.            { init(_S); }
  19.     ostream(_Uninitialized)
  20.         : ios(_Noinit) {}
  21.     virtual ~ostream();
  22.     _Bool opfx();
  23.     void osfx();
  24.     ostream& operator<<(ostream& (*_F)(ostream&))
  25.         {return ((*_F)(*this)); }
  26.     ostream& operator<<(ios& (*_F)(ios&))
  27.         {(*_F)(*(ios *)this); return (*this); }
  28.     ostream& operator<<(const char *);
  29.     ostream& operator<<(char _C)
  30.         {put(_C); return (*this); }
  31.     ostream& operator<<(unsigned char _C)
  32.         {return (*this << (char)_C); }
  33.     ostream& operator<<(short _X)
  34.         {return (_Print(&"B hoB hxB hd"[_If()], _X)); }
  35.     ostream& operator<<(unsigned short _X)
  36.         {return (_Print(&"B hoB hxB hu"[_If()], _X)); }
  37.     ostream& operator<<(int _X)
  38.         {return (_Print(&"B  oB  xB  d"[_If()], _X)); }
  39.     ostream& operator<<(unsigned int _X)
  40.         {return (_Print(&"B  oB  xB  u"[_If()], _X)); }
  41.     ostream& operator<<(long _X)
  42.         {return (_Print(&"B loB lxB ld"[_If()], _X)); }
  43.     ostream& operator<<(unsigned long _X)
  44.         {return (_Print(&"B loB lxB lu"[_If()], _X)); }
  45.     ostream& operator<<(float _X)
  46.         {return (_Print(&"P. eP. fP. g"[_Ff()], _Pr(), _X)); }
  47.     ostream& operator<<(double _X)
  48.         {return (_Print(&"P.leP.lfP.lg"[_Ff()], _Pr(), _X)); }
  49.     ostream& operator<<(long double _X)
  50.         {return (_Print(&"P.LeP.LfP.Lg"[_Ff()], _Pr(), _X)); }
  51.     ostream& operator<<(void *);
  52.     ostream& operator<<(streambuf&);
  53.     ostream& put(char);
  54.     ostream& write(const char *, int);
  55.     ostream& write(const unsigned char *_S, int _N)
  56.         {return (write((const char *)_S, _N)); }
  57.     ostream& flush();
  58. #if _HAS_SIGNED_CHAR
  59.     ostream& operator<<(signed char _C)
  60.         {return (*this << (char)_C); }
  61.     ostream& write(const signed char *_S, int _N)
  62.         {return (write((const char *)_S, _N)); }
  63. #endif /* _HAS_SIGNED_CHAR */
  64. protected:
  65.     int _Ff()
  66.         {return ((flags() & floatfield) == scientific ? 0
  67.             : (flags() & floatfield) == fixed ? 4 : 8); }
  68.     int _If()
  69.         {return ((flags() & basefield) == oct ? 0
  70.             : (flags() & basefield) == hex ? 4 : 8); }
  71.     void _Pad(const char *, char *, int);
  72.     int _Pr();
  73.     ostream& _Print(const char *, ...);
  74.     };
  75.         // manipulators
  76. ostream& endl(ostream&);
  77. ostream& ends(ostream&);
  78. ostream& flush(ostream&);
  79.  
  80. #if __MWERKS__
  81. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  82. #pragma import reset
  83. #endif
  84.  
  85. #pragma options align=reset
  86. #endif
  87.  
  88. #endif
  89.  
  90. /*
  91.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  92.  * Consult your license regarding permissions and restrictions.
  93.  */
  94.  
  95. /* Change log:
  96.  * 1994-06-04: PlumHall baseline
  97.  * 1994-09-30: Applied diffs for Fri Aug 26 00:51:20 1994
  98.  * 1994-10-07: Inserted MW changes.
  99.  * 1994-10-14: XL04 change istream(streambuf *_S) to init derived 
  100.  *//* Change log:
  101.  */
  102.